package com.jinmdz.fmis.mapper.mapper;

import com.jinmdz.fmis.mapper.entity.HistoryChargeSettlePayEntity;
import com.jinmdz.fmis.mapper.mapper.provider.HistoryChargeSettlePayProvider;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * 历史费用结算付款表Mapper
 *
 * @author generator
 * @date 2020-05-14 10:51
 */
public interface HistoryChargeSettlePayMapper {

    /**
     * 增加HistoryChargeSettlePay
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-05-14 10:51
     */
    @InsertProvider(type = HistoryChargeSettlePayProvider.class, method = "insertHistoryChargeSettlePay")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertHistoryChargeSettlePay(@Param("entity") HistoryChargeSettlePayEntity entity);

    /**
     * 删除HistoryChargeSettlePay
     *
     * @param id             主键
     * @param modifiedUserId 修改用户外键
     * @param version        版本号
     * @return
     * @author generator
     * @date 2020-05-14 10:51
     */
    @Update(" update history_charge_settle_pay set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForHistoryChargeSettlePay(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改HistoryChargeSettlePay
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-05-14 10:51
     */
    @UpdateProvider(type = HistoryChargeSettlePayProvider.class, method = "updateHistoryChargeSettlePay")
    void updateHistoryChargeSettlePay(@Param("entity") HistoryChargeSettlePayEntity entity);

    /**
     * 查询HistoryChargeSettlePay实体
     *
     * @param id 主键
     * @return HistoryChargeSettlePayEntity
     * @author generator
     * @date 2020-05-14 10:51
     */
    @Select(" select id,deleted,business_code,history_charge_id,charge_settle_id,pay_type_code,pay_type,pay_charge,pay_time,account_unit,random_code,history_charge_settle_id,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from history_charge_settle_pay where id = #{id} and deleted = 0 limit 1 ")
    HistoryChargeSettlePayEntity getHistoryChargeSettlePayById(@Param("id") Integer id);

    /**
     * 查询HistoryChargeSettlePay列表
     *
     * @param entity 数据实体
     * @return HistoryChargeSettlePayEntity
     * @author generator
     * @date 2020-05-14 10:51
     */
    @SelectProvider(type = HistoryChargeSettlePayProvider.class, method = "listHistoryChargeSettlePay")
    ArrayList<HistoryChargeSettlePayEntity> listHistoryChargeSettlePay(@Param("entity") HistoryChargeSettlePayEntity entity);
}